package com.campus.system.controller.admin;

import com.campus.common.dto.ResponseDto;
import com.campus.common.enums.VerifyCodeEnum;
import com.campus.common.utils.ValidatorUtil;
import com.campus.common.utils.VerifyCodeUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/verify-code")
public class VerifyCodeController {
    @Resource
    private VerifyCodeUtil verifyCodeUtil;
    @PostMapping("/register-email")
    public ResponseDto registerEmail(@RequestParam("email") String email) {
        ValidatorUtil.require(email, "邮箱");
        ValidatorUtil.containStr(email,"@", "邮箱");
        verifyCodeUtil.sendVerifyCode(email, VerifyCodeEnum.REGISTER_EMAIl_CODE.getCode());
        return new ResponseDto<>();
    }
}
